import json

class Solution:
    def reverseOnlyLetters1(self, s: str) -> str:
        # py3 不是很快，但是很短
        p = [i for i in s if i.isalpha()]
        return "".join([i if not i.isalpha() else p.pop() for i in s ])

    def reverseOnlyLetters(self, s: str) -> str:
        # 双指针
        ans = list(s)
        left, right = 0, len(s) - 1
        while True:
            # 判断左边是否扫描到字母
            while left < right and not ans[left].isalpha():
                left += 1
            # 判断右边是否扫描到字母
            while right > left and not ans[right].isalpha():
                right -= 1
            if left >= right:
                break
            ans[left], ans[right] = ans[right], ans[left]
            left += 1
            right -= 1
        return "".join(ans)

if __name__ == '__main__':
    s = json.loads(input())
    print(Solution().reverseOnlyLetters(s))

    